package com.ruoyi.system.service.tumor.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.tumor.ReportRecord;
import com.ruoyi.system.mapper.tumor.OrderDetailMapper;
import com.ruoyi.system.service.tumor.IOrderDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;


@Service
public class IOrderDetailServiceImpl implements IOrderDetailService {

    @Autowired
    private OrderDetailMapper orderDetailMapper;

    @Override
    public List<Map> selectOmsOrderListByPhone(Map map) {
        List<Map> list = new ArrayList<>();
        String phone = map.get("phone") == null?"":map.get("phone").toString();
        //0是未缴费，1是已缴费
        String status = map.get("status") == null?"":map.get("status").toString();
        if(StringUtils.isNotEmpty(phone)){
            if(StringUtils.isNotEmpty(status) && status.equals("0")){
                //未缴费订单，查询条件是 产品是对私的，main表里没被删除的，Detail表妹删除且没支付的
                list = orderDetailMapper.selectOmsOrderUnpaidListByPhone(phone);
            }else if(StringUtils.isNotEmpty(status) && status.equals("1")){
                list = orderDetailMapper.selectOmsOrderPayListByPhone(phone);
            }
        }
        return list;
    }
}
